Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment variable interface #3568

Merged
merged 5 commits into from
Aug 18, 2017
Merged

Conversation

gangliao
Copy link
Contributor

@gangliao gangliao commented Aug 18, 2017

export FRACTION_GPU_MEMORY_TO_USE=0.2
export GLOG_v=3

Then, run ctest -V -R memory_test

5: [ RUN      ] BuddyAllocator.GPUAllocation
75: I0818 14:34:34.431995 3000099776 memory.cc:87]
75:
75: NOTE: each GPU device use 20% of GPU memory.
75: You can set environment variable 'FRACTION_GPU_MEMORY_TO_USE' to change the fraction of GPU usage.
75:
75: I0818 14:34:34.432020 3000099776 buddy_allocator.cc:54] Allocate 4096 bytes from chunk size 4352
75: I0818 14:34:34.432656 3000099776 buddy_allocator.cc:193] Creating and inserting new block 0x700960000 from system allocator

fix #3437

@gangliao gangliao changed the title Add ENVIRONMENT interface interface Add environment variable interface Aug 18, 2017
@gangliao gangliao requested a review from wangkuiyi August 18, 2017 06:51
Copy link
Contributor

@typhoonzero typhoonzero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++

Just one comment, it should be fine to keep it unchanged.


namespace paddle {
namespace platform {

//! Environment variable: fraction of GPU memory to use on each device.
const std::string kEnvFractionGpuMemoryToUse = "FRACTION_GPU_MEMORY_TO_USE";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Environment variable often have prefix to distinguash between applications, to prevent if two application use the same name. Maybe start with "PADDLE_"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great! Thanks.

@gangliao gangliao merged commit 8c9a7f1 into PaddlePaddle:develop Aug 18, 2017
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
* fix bs=2 of FCOS

* fix bs=2 of ttfnet

* fix cascade deploy

* speedup by paddle.expand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Control GPU memory usage in unit tests
2 participants